import unittest

from nrt import ReplaceText


class TestNRT(unittest.TestCase):

    def test_rename(self):
        path = "/a/b/abc123.txt"

        rt = ReplaceText("\d\d\d", "ooo")
        new_path = rt.generate_new_path(path)
        print(new_path)

        self.assertEqual(
            ReplaceText("S01", "S02").generate_new_path("S01E01.mkv"), "S02E01.mkv"
        )
        self.assertEqual(
            ReplaceText("^", "S02").generate_new_path("E01.mkv"), "S02E01.mkv"
        )
        self.assertEqual(
            ReplaceText("$", "E01").generate_new_path("S02.mkv"), "S02E01.mkv"
        )
        self.assertEqual(
            ReplaceText("zh\.", "zh").generate_new_path("S01E24.zh..ass"),
            "S01E24.zh.ass",
        )
        self.assertEqual(
            ReplaceText(".zzzh", "").generate_new_path("S02E43.zzzh.zh.ass"),
            "S02E43.zh.ass",
        )


if __name__ == "__main__":
    unittest.main()
